package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    Page<Orders> conditionSearch(OrdersPageQueryDTO ordersPageQueryDTO);
@Select("select * from sky_take_out.orders where status =2 or status = 3 or status = 4")
    List<Orders> statistics();
@Update("update sky_take_out.orders set status = #{status} where id=#{id} ")
    void confirm(Orders orders);
@Update("update sky_take_out.orders set status=#{status},cancel_reason=#{cancelReason},cancel_time=#{cancelTime} where id=#{id} ")
    void updaterejection(Orders orders);


    Integer countByMap(Map map);

    Double sumByMap(Map map);

    void updatStatus(Map map);
@Update("update sky_take_out.orders set status=5 where status= 4")
    void orderStatusComplete();
}
